package com.abe.libquick.base;

import com.abe.libcore.AbeApplication;
import com.abe.libcore.utils.ForegroundCallbacks;
import com.abe.libcore.utils.context.ContextUtils;

public class BaseApplication extends AbeApplication implements ForegroundCallbacks.Listener {

    private static boolean isForeground = true;

    public static boolean isForeground() {
        return isForeground;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        ApplicationHelper.init(this);
        ContextUtils.Companion.init(this);
        //监听APP前台后台状态
        ForegroundCallbacks foregroundCallbacks = ForegroundCallbacks.init(this);
        foregroundCallbacks.addListener(this);
    }

    @Override
    public void onBecameForeground() {
        isForeground = true;
    }

    @Override
    public void onBecameBackground() {
        isForeground = false;
    }
}